package io.renren.modules.common.FtpInitRunner;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;

import io.renren.modules.common.service.DemandSensitiveWordService;

/***

@Title
:FtpInitRunner.java*@Package
io.renren.common*@Description
:TODO*@author
caosheng*@date
2019 年2月25日 下午12:51:44*@version
V1.0*/
/***
 * @Author :huhy*@DATE :Created on 2018/1/3 12:47*@Modified By:*@Class
 *         项目启动后运行此方法:CommandLineRunner实现
 */
@Component
@Order(value = 2)
public class FtpInitRunner implements CommandLineRunner {

	@Autowired
	private DemandSensitiveWordService demandSensitiveWordService;

	@Override
	// 项目启动后 会执行此方法
	public void run(String... var1) throws Exception {
		// 启动项目的时候 关键字的数据 全部放到缓存中去
		List<String> list = demandSensitiveWordService.sensitiveWord();
		HazelcastInstance sensitiveWord = Hazelcast.newHazelcastInstance();
		sensitiveWord.getMap("sensitiveWord").put("sensitiveWordList", list);

	}
}